<%@ page import="cn.edu.nuaa.model.Resource" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: wuzhuya
  Date: 2023/5/22
  Time: 上午11:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>文件管理</title>
</head>
<body>
<div>
    <div>
        <table border="1">
            <tr>
                <td width="200" align="center">文件上传</td>
                <td width="300" align="center">下载列表</td>
            </tr>
            <tr>
                <td height="100">
                    <form action="${pageContext.request.contextPath}/file/upload"
                          method="post" enctype="multipart/form-data">
                        <input type="file" name="file" multiple="multiple"><br/>
                        <input type="reset" value="清空"/>
                        <input type="submit" value="提交"/>
                    </form>
                </td>
                <td>
                    <ul>
                        <%
                            List<Resource> resources = (List<Resource>) request.getAttribute("resourceList");
                            for (Resource resource : resources) {
                                out.println("<li>" +
                                        "<a href=" + request.getContextPath() + "/file/download?filename=" + resource.getName() + ">" + resource.getName() + "</a>" +
                                        "</li>");
                            }
                        %>
                        <%--<li>
                        <c:forEach var="item" items="${resourceList}">
                            <a href="${pageContext.request.contextPath}/file/download?filename=${item.name}">${item.name}</a>
                            </li>
                        </c:forEach>--%>
                    </ul>
                </td>
            </tr>
            <tr>
                <td>
                    <a href="${pageContext.request.contextPath}/user/logout">退出登陆</a>
                </td>
            </tr>
        </table>
    </div>
</div>
</body>
<script>
</script>

</html>
